# Usage : bundle exec fastlane ios (patch | minor | major)

default_platform(:ios)

platform :ios do
  desc "Release a new version with a patch bump_type"
  lane :patch do
    release("patch")
  end

  desc "Release a new version with a minor bump_type"
  lane :minor do
    release("minor")
  end

  desc "Release a new version with a major bump_type"
  lane :major do
    release("major")
  end

  def release(type)
    podspec_name = "GBHFacebookImagePicker.podspec" 
    pod_lib_lint(use_bundle_exec: false, allow_warnings: true)
    version = version_bump_podspec(path: podspec_name, bump_type: type)
    git_add(path: podspec_name)
    git_commit(path: [podspec_name], message: "#{version} release")
    add_git_tag(tag: "#{version}")
    push_to_git_remote
    pod_push(use_bundle_exec: false, allow_warnings: true)
  end
end